import java.util.ArrayList;
import java.util.Iterator;


public class Principal {
	
	public static void main(String [] args)
	{
		GestorDocumentos gestor;
		IndiceInvertido indice;
		
		gestor = new GestorDocumentos();
		indice = new IndiceInvertido();
				
		ArrayList<Documento> documents = new ArrayList<Documento>();
		documents.add(new Documento(new String("A brilliant, festive study of JS Bach uses literature and painting to illuminate his 'dance-impregnated' music, writes Peter Conrad")));
		documents.add(new Documento(new String("Fatima Bhutto on Malala Yousafzai's fearless and still-controversial memoir")));
		documents.add(new Documento(new String("Grisham's sequel to A Time to Kill is a solid courtroom drama about racial prejudice marred by a flawless white hero, writes John O'Connell")));
		documents.add(new Documento(new String("This strange repackaging of bits and pieces does the Man Booker winner no favours, says Sam Leith")));
		documents.add(new Documento(new String("Another book with music related content")));
		documents.add(new Documento(new String("Another book with music related content")));
		
		Iterator<Documento> i = documents.iterator();
		while (i.hasNext())
		{
			Documento doc = (Documento)i.next();
			if (gestor.addDocument(doc))
				indice.addDocument(doc);
		}
		
		ArrayList<String> results = indice.getDocuments("music");
		System.out.println(results.size());
		System.out.println(results);
	}
}
